#!/bin/bash

flist="wlist.txt"

    files=$(ls ${1}/${floder}/)
    for file in $files 
    do
        input="${1}/${floder}/${file}"
    
        time1=$(date)
        echo ""	
        echo ${time1}

        lb=`grep "^c pre_LB " $input | cut -d ' ' -f 3`
        k=`grep "^c k " $input | cut -d ' ' -f 3`
        bef=`grep "^$file" $flist` 

        echo "timeout 12000 ../../../KDefective -r ${input} -O solve -a MADEC -D Set -k ${k} -M ${lb} -t 10800"
        
	if [ -z "$bef" ]
        then 
            echo "wrong before !!!"
        elif [ -z "$lb" -a -z "$k" ]
        then
            echo "prework wrong !!!"
        else 
            timeout 12000 ../../../KDefective -r ${input} -O solve -a MADEC -D Set -k ${k} -M ${lb} -t 10800
        fi
    done

